package com.itheima.stock.config;

import com.itheima.stock.pojo.vo.StockInfoConfig;
import com.itheima.stock.utils.IdWorker;
import com.itheima.stock.utils.ParserStockInfoUtil;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties({StockInfoConfig.class})
public class CommonConfig {
    /**
     * 1.机器id
     * 2、机房id
     * @return
     */

    //唯一sessionid
    @Bean
    public IdWorker idWorker() {
        return new IdWorker(1L, 2L);
    }

    @Bean
    public ParserStockInfoUtil parserStockInfoUtil( ) {
        return new ParserStockInfoUtil(idWorker());
    }
}
